﻿using AutoMapper;
using Core.Services.Menu.Dtos;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Core.Web.Pages.Menu.Models
{
    public class Mapper:Profile
    {
        public Mapper()
        {
            CreateMap<MenuDto, MenuTreeViewModel>();
            CreateMap<MenuDto, MenuListViewModel>()
                 .ForMember(dest => dest.ParentName, m => m.MapFrom(src => src.Parent != null ? src.Parent.Name : ""));
            //CreateMap<MenuDto, MenuViewModel>()
            //     .ForMember(dest => dest.ParentName, m => m.MapFrom(src => src.Parent != null ? src.Parent.Name : "")).ReverseMap();
        }
    }
}
